<?php /*a:2:{s:69:"C:\Users\Administrator\Desktop\kitecms\app\admin\view\menu\index.html";i:1572835690;s:72:"C:\Users\Administrator\Desktop\kitecms\app\admin\view\common\header.html";i:1572833562;}*/ ?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/admin/css/font.css">
    <link rel="stylesheet" href="/static/admin/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav hide">
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加菜单','<?php echo url("add"); ?>')"><i class="layui-icon"></i>添加菜单</button>
    </xblock>
    <table class="layui-table layui-form">
        <thead>
        <tr>
            <th>ID</th>
            <th>图标</th>
            <th>菜单名称</th>
            <th>所属控制器</th>
            <th>操作方法</th>
            <th>菜单显示</th>
            <th>操作</th></tr>
        </thead>
        <tbody>
        <?php foreach($list as $vo): ?>
        <tr>
            <td><?php echo htmlentities($vo['id']); ?></td>
            <td><i class="icon iconfont"><?php echo html_entity_decode('&'.$vo['icon']); ?></i></td>
            <td><?php echo html_entity_decode($vo['str']); ?><?php echo htmlentities($vo['title']); ?></td>
            <td><?php echo htmlentities($vo['controller']); ?></td>
            <td><?php echo htmlentities($vo['methods']); ?></td>
            <td><input type="checkbox" lay-filter="switch" lay-skin="switch" value="<?php echo htmlentities($vo['id']); ?>" <?php if($vo['is_nav'] == 1): ?>checked<?php endif; ?> lay-text="ON|OFF"></td>
            <td class="td-manage">
                <a title="编辑"  onclick="x_admin_show('编辑','<?php echo url("edit"); ?>?id=<?php echo htmlentities($vo['id']); ?>')" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                </a>
                <a title="删除" onclick="member_del(this,'<?php echo htmlentities($vo['id']); ?>')" href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>
                </a>
            </td>
        </tr>
        <?php endforeach; ?>
        </tbody>
    </table>

</div>
<script>
    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $.get("<?php echo url('del'); ?>",{id:id},function (res) {
                if (res.success){
                    $(obj).parents("tr").remove();
                    layer.msg(res.msg,{icon:1,time:1000});
                }else{
                    layer.msg(res.msg,{icon:2,time:1000});
                }
            });

        });
    }
    layui.use(['form'],function () {
        var form = layui.form;
        form.on('switch(switch)', function(data){
            var id = data.value,
                is_nav = 0;
            if (data.elem.checked){
                is_nav = 1;
            }
            var load = layer.load(1);
            $.post("<?php echo url('edit'); ?>",{
                id:id,
                data:{
                    is_nav:is_nav
                }
            },function (res) {
                layer.close(load);
                if (res.success){
                    layer.msg(res.msg,{icon:1})
                } else{
                    layer.msg(res.msg,{icon:2})
                }
            });
        });
    })
</script>
</body>

</html>